<%--
  Created by IntelliJ IDEA.
  User: wo
  Date: 2022/1/7
  Time: 9:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java" isELIgnored="false" isErrorPage="true" %>
<%
    pageContext.setAttribute("ctp", request.getContextPath());
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>人事管理系统 ——员工管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="expires" content="0" />
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
    <meta http-equiv="description" content="This is my page" />
    <link href="${ctp}/css/css.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="${ctp}/js/ligerUI/skins/Aqua/css/ligerui-dialog.css"/>
    <link href="${ctp}/js/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="${ctp}/js/jquery-1.11.0.js"></script>
    <script type="text/javascript" src="${ctp}/js/jquery-migrate-1.2.1.js"></script>
    <script src="${ctp}/js/ligerUI/js/core/base.js" type="text/javascript"></script>
    <script src="${ctp}/js/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
    <script src="${ctp}/js/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
    <script src="${ctp}/js/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
    <script src="${ctp}/js/jquery.pagination.min.js" type="text/javascript"></script>
    <link href="${ctp}/css/pager.css" type="text/css" rel="stylesheet" />
    <link href="${ctp}/css/jquery.pagination.css" type="text/css" rel="stylesheet" />

    <script type="text/javascript">
        $(function(){
            /** 获取上一次选中的部门数据 */
            var boxs  = $("input[type='checkbox'][id^='box_']");
            // alert(boxs)
            /** 给全选按钮绑定点击事件  */
            $("#checkAll").click(function(){
                // this是checkAll  this.checked是true
                // 所有数据行的选中状态与全选的状态一致
                boxs.attr("checked",this.checked);
            })

            /** 给数据行绑定鼠标覆盖以及鼠标移开事件  */
            $("tr[id^='data_']").hover(function(){
                $(this).css("backgroundColor","#eeccff");
            },function(){
                $(this).css("backgroundColor","#ffffff");
            })


            /** 删除员工绑定点击事件 */
            $("#delete").click(function(){
                /** 获取到用户选中的复选框  */
                var checkedBoxs = boxs.filter(":checked");
                if(checkedBoxs.length < 1){
                    $.ligerDialog.error("请选择一个需要删除的员工！");
                }else{
                    /** 得到用户选中的所有的需要删除的ids */
                    var ids = checkedBoxs.map(function(){
                        return this.value;
                    })

                    $.ligerDialog.confirm("确认要删除吗?","删除员工",function(r){
                        if(r){
                            // alert("删除："+ids.get());
                            // 发送请求
                            window.location = "${ctp}/employee/deleteemployee?ids=" + ids.get();
                        }
                    });
                }
            })
        })
    </script>
</head>
<body>
<!-- 导航 -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr><td height="10"></td></tr>
    <tr>
        <td width="15" height="32"><img src="${ctp}/images/main_locleft.gif" width="15" height="32"></td>
        <td class="main_locbg font2"><img src="${ctp}/images/pointer.gif">&nbsp;&nbsp;&nbsp;当前位置：员工管理 &gt; 员工查询</td>
        <td width="15" height="32"><img src="${ctp}/images/main_locright.gif" width="15" height="32"></td>
    </tr>
</table>
<%--<form action="${ctp}/employee/selectemployee" method="post">--%>
<table width="100%" height="90%" border="0" cellpadding="5" cellspacing="0" class="main_tabbor">
    <!-- 查询区  -->
    <tr valign="top">
        <td height="30">
            <table width="100%" border="0" cellpadding="0" cellspacing="10" class="main_tab">
                <tr>
                    <td class="fftd">

                        <form action="${ctp}/employee/selectemployee">
                            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td class="font3">
                                        职位：
                                        <select name="jobId" style="width:143px;">
                                            <option value="">--请选择职位--</option>
                                            <c:forEach items="${jobInfs}" var="job">
                                                <c:if test="${employeeInf.jobId==job.id}">
                                                 <option value="${job.id}" selected="selected">${job.name}</option>
                                                </c:if>
                                                 <c:if test="${employeeInf.jobId!=job.id}">
                                                 <option value="${job.id}" >${job.name}</option>
                                                </c:if>
                                            </c:forEach>
                                        </select>
                                        姓名：<input type="text" name="name" value="${employeeInf.name}">
                                        身份证号码：<input type="text" name="cardId" maxlength="18" value="${employeeInf.cardId}">
                                    </td>
                                </tr>
                                <tr>
                                    <td class="font3">
                                        性别：
                                        <select name="sex" style="width:143px;">
                                            <option value="">--请选择性别--</option>
                                            <c:if test="${employeeInf.sex==1}">
                                                <option value="1" selected="selected">男</option>
                                                <option value="2">女</option>
                                            </c:if>
                                            <c:if test="${employeeInf.sex==2}">
                                                <option value="1">男</option>
                                                <option value="2" selected="selected">女</option>
                                            </c:if>
                                             <c:if test="${employeeInf.sex==null}">
                                                <option value="1">男</option>
                                                <option value="2">女</option>
                                            </c:if>

                                        </select>
                                        手机：<input type="text" name="phone   " value="${employeeInf.phone}">
                                        所属部门：<select  name="deptId" style="width:100px;">
                                        <option value="">--部门选择--</option>
                                        <c:forEach items="${deptInfs}" var="dept">
                                            <c:if test="${employeeInf.deptId==dept.id}">
                                                <option value="${dept.id}" selected="selected">${dept.name}</option>
                                            </c:if>
                                            <c:if test="${employeeInf.deptId!=dept.id}">
                                                <option value="${dept.id}">${dept.name}</option>
                                            </c:if>

                                        </c:forEach>

                                    </select>&nbsp;
                                        <input type="submit" value="搜索"/>
                                        <input id="delete" type="button" value="删除"/>
                                    </td>
                                </tr>
                            </table>
                        </form>

                    </td>
                </tr>
            </table>
        </td>
    </tr>

    <!-- 数据展示区 -->

    <tr valign="top">
        <td height="20">
            <table width="100%" border="1" cellpadding="5" cellspacing="0" style="border:#c2c6cc 1px solid; border-collapse:collapse;">
                <tbody><tr class="main_trbg_tit" align="center">
                    <td><input type="checkbox" name="checkAll" id="checkAll"></td>
                    <td>姓名</td>
                    <td>性别</td>
                    <td>手机号码</td>
                    <td>邮箱</td>
                    <td>职位</td>
                    <td>学历</td>
                    <td>身份证号码</td>
                    <td>部门</td>
                    <td>联系地址</td>
                    <td>建档日期</td>

                    <td align="center">操作</td>

                </tr>

<%--                <tr id="data_0" class="main_trbg" align="center" style="background-color: rgb(255, 255, 255);">--%>
<%--                    <td><input type="checkbox" id="box_0" value="1"></td>--%>
<%--                    <td>爱丽丝</td>--%>
<%--                    <td>--%>


<%--                        女--%>

<%--                    </td>--%>
<%--                    <td>13902001111</td>--%>
<%--                    <td>251425887@qq.com</td>--%>
<%--                    <td>经理</td>--%>
<%--                    <td>本科</td>--%>
<%--                    <td>4328011988</td>--%>
<%--                    <td>技术部</td>--%>
<%--                    <td>广州天河</td>--%>
<%--                    <td>--%>
<%--                        2016年3月14日--%>
<%--                    </td>--%>

<%--                    <td align="center" width="40px;"><a href="showUpdateEmployee.jsp">--%>
<%--                        <img title="修改" src="${ctp}/images/update.gif"></a>--%>
<%--                    </td>--%>

<%--                </tr>--%>

<%--                <tr id="data_1" class="main_trbg" align="center" style="background-color: rgb(255, 255, 255);">--%>
<%--                    <td><input type="checkbox" id="box_1" value="2"></td>--%>
<%--                    <td>杰克</td>--%>
<%--                    <td>--%>


<%--                        女--%>

<%--                    </td>--%>
<%--                    <td>4247242</td>--%>
<%--                    <td>251425887@qq.com</td>--%>
<%--                    <td>职员</td>--%>
<%--                    <td></td>--%>
<%--                    <td>22623</td>--%>
<%--                    <td>运营部</td>--%>
<%--                    <td>43234</td>--%>
<%--                    <td>--%>
<%--                        2016年3月14日--%>
<%--                    </td>--%>

<%--                    <td align="center" width="40px;"><a href="showUpdateEmployee.jsp">--%>
<%--                        <img title="修改" src="${ctp}/images/update.gif"></a>--%>
<%--                    </td>--%>

<%--                </tr>--%>

<%--                <tr id="data_2" class="main_trbg" align="center" style="background-color: rgb(255, 255, 255);">--%>
<%--                    <td><input type="checkbox" id="box_2" value="23"></td>--%>
<%--                    <td>邹格明</td>--%>
<%--                    <td>--%>

<%--                        男--%>


<%--                    </td>--%>
<%--                    <td>13123455678</td>--%>
<%--                    <td>11@163.com</td>--%>
<%--                    <td>职员</td>--%>
<%--                    <td>大专</td>--%>
<%--                    <td>210303198001010010</td>--%>
<%--                    <td>技术部</td>--%>
<%--                    <td>大连</td>--%>
<%--                    <td>--%>
<%--                        2019年4月11日--%>
<%--                    </td>--%>

<%--                    <td align="center" width="40px;"><a href="showUpdateEmployee.jsp">--%>
<%--                        <img title="修改" src="${ctp}/images/update.gif"></a>--%>
<%--                    </td>--%>

<%--                </tr>--%>

                <c:forEach items="${employeeInfPageInfo.list}" var="emp">
                    <tr id="data_${emp.id}" class="main_trbg" align="center" style="background-color: rgb(255, 255, 255);">
                        <td><input type="checkbox" id="box_${emp.id}" value="${emp.id}"></td>
                        <td>${emp.name}</td>
                        <td>
                            ${emp.sex==1?'男':'女'}
                        </td>
                        <td>${emp.phone}</td>
                        <td>${emp.email}</td>
                        <td>${emp.jobInf.name}</td>
                        <td>${emp.education}</td>
                        <td>${emp.cardId}</td>
                        <td>${emp.deptInf.name}</td>
                        <td>${emp.address}</td>
                        <td>
                            ${emp.createDate}
                        </td>

                        <td align="center" width="40px;"><a href="${ctp}/employee/toUpdateemployee?id=${emp.id}">
                            <img title="修改" src="${ctp}/images/update.gif"></a>
                        </td>

                    </tr>
                </c:forEach>

                </tbody></table>
        </td>
    </tr>
    <!-- 分页标签 -->
    <tr valign="top">
        <td align="center" class="font3">
            <table width="100%" align="center" style="font-size:13px;" class="digg">
                <tbody>
                <tr>
                    <td style="COLOR: #0061de; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; TEXT-DECORATION: none">
                        <%--            <span class="disabled">上一页</span>--%>
                        <%--            <span class="current">1</span>--%>
                        <%--            <span class="disabled">下一页</span>&nbsp;--%>
                        <div id="M-box">

                        </div>
                        <form action="${ctp}/employee/selectemployee" method="get">
                            跳转到&nbsp;&nbsp;
                            <input style="text-align: center;BORDER-RIGHT: #aaaadd 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #aaaadd 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #aaaadd 1px solid; COLOR: #000099; PADDING-TOP: 2px; BORDER-BOTTOM: #aaaadd 1px solid; TEXT-DECORATION: none" type="text" size="2" id="pager_jump_page_size" name="page">&nbsp;
                            <input type="hidden" name="deptId" value="${employeeInf.deptId}">
                            <input type="hidden" name="sex" value="${employeeInf.sex}">
                            <input type="hidden" name="name" value="${employeeInf.name}">
                            <input type="hidden" name="phone" value="${employeeInf.phone}">
                            <input type="hidden" name="cardId" value="${employeeInf.cardId}">
                            <input type="hidden" name="jobId" value="${employeeInf.jobId}">
                            <input type="submit" style="text-align: center;BORDER-RIGHT: #dedfde 1px solid; PADDING-RIGHT: 6px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #dedfde 1px solid; PADDING-LEFT: 6px; PADDING-BOTTOM: 2px; BORDER-LEFT: #dedfde 1px solid; COLOR: #0061de; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; BORDER-BOTTOM: #dedfde 1px solid; TEXT-DECORATION: none" value="确定" id="pager_jump_btn">
                        </form>


                    </td>
                </tr>
                <tr align="center">
                    <td style="font-size:13px;"></td>
                </tr>
                <tr>
                    <td style="COLOR: #0061de; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; TEXT-DECORATION: none">
                        总共<font color="red">${employeeInfPageInfo.total}</font>条记录，当前显示${employeeInfPageInfo.startRow}-${employeeInfPageInfo.endRow}条记录。
                    </td>
                </tr>
                </tbody>
            </table>
        </td>
    </tr>
</table>
<%--</form>--%>
<div style="height:10px;"></div>
<script>


    $(function (){
        var pageNum = ${employeeInfPageInfo.pageNum};
        var pages = ${employeeInfPageInfo.pages};

        $("#M-box").pagination({
            currentPage: pageNum,
            totalPage: pages,
            num_edge_entries:4,
            num_display_entries:10,
            homePageText:"首页",
            prevPageText:"上一页",
            nextPageText:"下一页",
            endPageText:"尾页",
            callback: function (current) {
                location.href = "${ctp}/employee/selectemployee?page="+current+"&deptId=${employeeInf.deptId}"+"&sex=${employeeInf.sex}"+"&name=${employeeInf.name}"+"&phone=${employeeInf.phone}"+"&cardId=${employeeInf.cardId}"+"&jobId=${employeeInf.jobId}";
            }
        });

        $(function(){
            $("#checkAll").click(function(){
                $("input[name='check']").prop("checked",this.checked);
            });
        })
    });
</script>
</body>
</html>